load("//tools:defs.bzl", "go_library", "go_test")

package(
    default_applicable_licenses = ["//:license"],
    licenses = ["notice"],
)

go_library(
    name = "boot",
    srcs = [
        "autosave.go",
        "compat.go",
        "compat_amd64.go",
        "compat_arm64.go",
        "controller.go",
        "debug.go",
        "events.go",
        "gofer_conf.go",
        "limits.go",
        "loader.go",
        "mount_hints.go",
        "network.go",
        "restore.go",
        "seccheck.go",
        "strace.go",
        "vfs.go",
    ],
    visibility = [
        "//pkg/test:__subpackages__",
        "//runsc:__subpackages__",
        "//test:__subpackages__",
    ],
    deps = [
        "//pkg/abi",
        "//pkg/abi/linux",
        "//pkg/abi/nvgpu",
        "//pkg/abi/tpu",
        "//pkg/bpf",
        "//pkg/cleanup",
        "//pkg/context",
        "//pkg/control/server",
        "//pkg/coverage",
        "//pkg/cpuid",
        "//pkg/devutil",
        "//pkg/errors/linuxerr",
        "//pkg/eventchannel",
        "//pkg/fd",
        "//pkg/flipcall",
        "//pkg/fspath",
        "//pkg/hostos",
        "//pkg/log",
        "//pkg/memutil",
        "//pkg/rand",
        "//pkg/refs",
        "//pkg/sentry/arch",
        "//pkg/sentry/arch:registers_go_proto",
        "//pkg/sentry/control",
        "//pkg/sentry/devices/accel",
        "//pkg/sentry/devices/memdev",
        "//pkg/sentry/devices/nvproxy",
        "//pkg/sentry/devices/tpuproxy",
        "//pkg/sentry/devices/ttydev",
        "//pkg/sentry/devices/tundev",
        "//pkg/sentry/fdimport",
        "//pkg/sentry/fsimpl/cgroupfs",
        "//pkg/sentry/fsimpl/dev",
        "//pkg/sentry/fsimpl/devpts",
        "//pkg/sentry/fsimpl/devtmpfs",
        "//pkg/sentry/fsimpl/erofs",
        "//pkg/sentry/fsimpl/fuse",
        "//pkg/sentry/fsimpl/gofer",
        "//pkg/sentry/fsimpl/host",
        "//pkg/sentry/fsimpl/mqfs",
        "//pkg/sentry/fsimpl/overlay",
        "//pkg/sentry/fsimpl/proc",
        "//pkg/sentry/fsimpl/sys",
        "//pkg/sentry/fsimpl/tmpfs",
        "//pkg/sentry/fsimpl/user",
        "//pkg/sentry/inet",
        "//pkg/sentry/kernel",
        "//pkg/sentry/kernel/auth",
        "//pkg/sentry/limits",
        "//pkg/sentry/loader",
        "//pkg/sentry/pgalloc",
        "//pkg/sentry/platform",
        "//pkg/sentry/seccheck",
        "//pkg/sentry/seccheck/points:points_go_proto",
        "//pkg/sentry/seccheck/sinks/null",
        "//pkg/sentry/seccheck/sinks/remote",
        "//pkg/sentry/socket/hostinet",
        "//pkg/sentry/socket/netfilter",
        "//pkg/sentry/socket/netlink",
        "//pkg/sentry/socket/netlink/route",
        "//pkg/sentry/socket/netlink/uevent",
        "//pkg/sentry/socket/netstack",
        "//pkg/sentry/socket/unix",
        "//pkg/sentry/state",
        "//pkg/sentry/strace",
        "//pkg/sentry/time",
        "//pkg/sentry/unimpl:unimplemented_syscall_go_proto",
        "//pkg/sentry/usage",
        "//pkg/sentry/vfs",
        "//pkg/sentry/watchdog",
        "//pkg/sighandling",
        "//pkg/state/statefile",
        "//pkg/sync",
        "//pkg/tcpip",
        "//pkg/tcpip/link/ethernet",
        "//pkg/tcpip/link/fdbased",
        "//pkg/tcpip/link/loopback",
        "//pkg/tcpip/link/qdisc/fifo",
        "//pkg/tcpip/link/sniffer",
        "//pkg/tcpip/link/xdp",
        "//pkg/tcpip/network/arp",
        "//pkg/tcpip/network/ipv4",
        "//pkg/tcpip/network/ipv6",
        "//pkg/tcpip/stack",
        "//pkg/tcpip/transport/icmp",
        "//pkg/tcpip/transport/raw",
        "//pkg/tcpip/transport/tcp",
        "//pkg/tcpip/transport/udp",
        "//pkg/urpc",
        "//runsc/boot/filter",
        "//runsc/boot/platforms",
        "//runsc/boot/portforward",
        "//runsc/boot/pprof",
        "//runsc/boot/procfs",
        "//runsc/config",
        "//runsc/profile",
        "//runsc/specutils",
        "//runsc/specutils/seccomp",
        "@com_github_opencontainers_runtime_spec//specs-go:go_default_library",
        "@com_github_syndtr_gocapability//capability:go_default_library",
        "@org_golang_google_protobuf//proto:go_default_library",
        "@org_golang_x_sys//unix:go_default_library",
    ],
)

go_test(
    name = "boot_test",
    size = "small",
    srcs = [
        "compat_test.go",
        "gofer_conf_test.go",
        "loader_test.go",
        "mount_hints_test.go",
        "vfs_test.go",
    ],
    library = ":boot",
    deps = [
        "//pkg/control/server",
        "//pkg/cpuid",
        "//pkg/fspath",
        "//pkg/log",
        "//pkg/sentry/fsimpl/erofs",
        "//pkg/sentry/kernel/auth",
        "//pkg/sentry/seccheck",
        "//pkg/sentry/vfs",
        "//pkg/sync",
        "//pkg/unet",
        "//runsc/config",
        "//runsc/flag",
        "//runsc/fsgofer",
        "@com_github_opencontainers_runtime_spec//specs-go:go_default_library",
        "@com_github_syndtr_gocapability//capability:go_default_library",
        "@org_golang_x_sys//unix:go_default_library",
    ],
)
